package com.msc.cili.service.subscribe.impl;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.msc.cili.repository.dao.subscribe.SubRecordMapper;
import com.msc.cili.repository.entity.subscribe.SubRecord;
import com.msc.cili.service.subscribe.SubRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author masc
 * @date 2022/6/24 23:56
 * <p></p>
 */
@Service
public class SubRecordServiceImpl extends ServiceImpl<SubRecordMapper, SubRecord> implements SubRecordService {
    @Autowired
    private SubRecordMapper subRecordMapper;

    @Override
    public IPage<SubRecord> getAllScribeRecordByUserId(Integer userId, int pageIndex, int pageSize) {
        QueryWrapper<SubRecord> queryWrapper=new QueryWrapper<>();
        queryWrapper.lambda().eq(SubRecord::getUserId,userId);
        Page<SubRecord> page=new Page<>(pageIndex,pageSize);
        IPage<SubRecord> subRecordIPage = subRecordMapper.selectPage(page, queryWrapper);
        return subRecordIPage;
    }
}
